package com.ruoyi.web.controller.train;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.train.domain.JyTrainingSchoolCourseOutline;
import com.ruoyi.train.service.IJyTrainingSchoolCourseOutlineService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 培训课程大纲Controller
 *
 * @author aulbrother
 * @date 2024-04-06
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/training/school/course/outline")
public class JyTrainingSchoolCourseOutlineController extends BaseController {
    private final IJyTrainingSchoolCourseOutlineService jyTrainingSchoolCourseOutlineService;

    /**
     * 查询培训课程大纲列表
     */
    @GetMapping("/list")
    public TableDataInfo list(JyTrainingSchoolCourseOutline jyTrainingSchoolCourseOutline) {
        startPage();
        List<JyTrainingSchoolCourseOutline> list = jyTrainingSchoolCourseOutlineService.selectJyTrainingSchoolCourseOutlineList(jyTrainingSchoolCourseOutline);
        return getDataTable(list);
    }

    /**
     * 获取培训课程大纲详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(jyTrainingSchoolCourseOutlineService.selectJyTrainingSchoolCourseOutlineById(id));
    }

    /**
     * 修改培训课程大纲
     */
    @Log(title = "培训课程大纲", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JyTrainingSchoolCourseOutline jyTrainingSchoolCourseOutline) {
        return toAjax(jyTrainingSchoolCourseOutlineService.updateJyTrainingSchoolCourseOutline(jyTrainingSchoolCourseOutline));
    }
}
